import  React from "react";
import { useRoutes } from "react-router-dom";

import List from '../pages/List';
import Detail from '../pages/Detail';
import Home from '../pages/Home';
import Uc from '../pages/Uc';
import Login from '../pages/Login';
import ChangePwd from '../pages/Pwd';
import ChangeName from '../pages/ChangeName';
import NotFound from '../pages/NotFound';

// 用户中心的 子路由
import ucRouter from "./ucRouter";

export default ()=> {
    // 允许我们通过一个数组的方式来进行路由的配置
    // 通过这种方式  能更好的让我们进行模块化的开发 灵活的进行路由 配置
  let element = useRoutes([
    { path: "/", element: <Home /> },
    { path: "/list", element: <List /> },
    { path:"/detail/:id", element: <Detail /> },
    { 
        path:"/uc" ,
        element: <Uc />,
        children: ucRouter 
    },
    { path: "/login", element: <Login /> },
    { path: "*", element: <NotFound /> },


  ]);


  return element;
}
